from socket import *

HOST = 'localhost'
PORT = 9998
BUFSIE = 1024
ADDR = (HOST, PORT)

tcpCliCock = socket(AF_INET, SOCK_STREAM)
tcpCliCock.connect(ADDR)

while True:
    data = input('>')
    if not data:
        break
    tcpCliCock.send(data)
    data = tcpCliCock.recv(BUFSIE)
    if not data:
        break
    print(data)
tcpCliCock.close()
